﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title></title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

      

        .box1 {
            width: calc(100% - 10%);
           height:160px;
            overflow: hidden;
            margin: auto;
            border-radius:10px;
            position:relative;
        }
        .box2 {
            position:absolute;
            width: 300%;
           transition:all .5s linear;
        }
        img {
            width:364px;
        }

       li {
            width:33.33%;
            float: left;
        }
    </style>
</head>
<body>
    <div class="box1">
            <div class="box2">
                <ul>
                    <li> <a href=""><img src="zy1.jpg" alt="Alternate Text" /></a></li>
                    <li> <a href=""><img src="zy2.jpg" alt="Alternate Text" /></a></li>
                    <li> <a href=""><img src="zy3.jpg" alt="Alternate Text" /></a></li>
                </ul>
            </div>
        </div>
    <script>
        let div = document.querySelector(`.box1`);
        let div1 = document.querySelector(`.box2`);
        let x = 0;
        let x1 = 0;
        let i = 0;
        div.ontouchstart = function (e) {
            x = e.touches[0].clientX;
           
        }
        div.ontouchend = function (e) {
          
            if (x1 - x > 50) {
                i++;
                div1.style.left = `${100*i}`;
            } else if (x1 - x < -50) {
                div1.style.left = `-100%`;
            }
        }
        div.ontouchmove = function (e) {
            x1 = e.touches[0].clientX;
           
        }
      
    </script>
</body>
</html>